package com.icss.mqsp.data.process.factory;

import com.icss.mqsp.config.PropertyConfig;
import com.icss.mqsp.data.process.IDataProcessor;
import com.icss.mqsp.util.ResourcesUtil;
import com.icss.pangu.logging.Log;
import com.icss.pangu.logging.LogFactory;

public class DataProcessorFactory
{
  private static Log log = LogFactory.getLog(DataProcessorFactory.class);
  
  public static IDataProcessor getDataProcesser(String type)
  {
    PropertyConfig pc = PropertyConfig.getInstance("dataProcessor");
    String processer = pc.getProperty(type);
    IDataProcessor dataProcesser = null;
    try
    {
      dataProcesser = (IDataProcessor)ResourcesUtil.instantiate(processer);
    }
    catch (Exception e)
    {
      log.error(e.toString());
    }
    return dataProcesser;
  }
}
